package com.hlm.demo.entity;

import com.fasterxml.jackson.annotation.JsonFormat;

import com.hlm.demo.validator.accountvalidator.AccountAddValidator;
import com.hlm.demo.validator.accountvalidator.AccountUpdValidator;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

import java.io.Serializable;
import java.util.Date;



/**
 * @author MRD
 */
public class Account implements Serializable {

    private Integer accountId;
    @NotNull(message = "推荐人的账务ID不能为空",groups = {AccountAddValidator.class})
    private Integer recommenderId;
    @NotBlank(message = "登录名不能为空或全为空格",groups = {AccountAddValidator.class})
    private String loginName;
    @NotBlank(message = "登录密码不能为空或全为空格",groups = {AccountAddValidator.class})
    private String loginPasswd;
    @NotBlank(message = "确认密码不能为空或全为空格",groups = {AccountAddValidator.class})

    private String repeat;
    private Integer accountStatus;
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date createDate;
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date pauseDate;
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date closeDate;

    @NotBlank(message = "真实姓名不能为空或全为空格",groups = {AccountUpdValidator.class,AccountAddValidator.class})
    private String realName;
    @NotBlank(message = "身份证号码不能为空或全为空格",groups = {AccountAddValidator.class})
    @Pattern(regexp = "^[1-9]\\d{5}(18|19|([23]\\d))\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$",message = "身份证号码格式不正确",groups = {AccountAddValidator.class})
    private String idcardNo;
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date birthdate;
    @NotBlank(message = "性别不能为空或全为空格",groups = {AccountAddValidator.class})
    private String gender;
    @NotBlank(message = "职业不能为空或全为空格",groups = {AccountAddValidator.class,AccountUpdValidator.class})
    private String occupation;
    @NotBlank(message = "手机号码不能为空或全为空格",groups = {AccountUpdValidator.class,AccountAddValidator.class})
    @Pattern(regexp = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(18[0,5-9]))\\d{8}$",message = "手机号格式不正确",groups = {AccountUpdValidator.class, AccountAddValidator.class})
    private String telephone;
    @NotBlank(message = "邮箱不能为空或全为空格",groups = {AccountAddValidator.class,AccountUpdValidator.class})
    @Email(message = "邮箱格式不正确",groups = {AccountAddValidator.class,AccountUpdValidator.class})
    private String email;
    @NotBlank(message = "通讯地址不能为空或全为空格",groups = {AccountAddValidator.class,AccountUpdValidator.class})
    private String mailaddress;
    @NotBlank(message = "邮政编码不能为空或全为空格",groups = {AccountAddValidator.class,AccountUpdValidator.class})
    @Pattern(regexp = "[0-9]{6}",message = "邮箱编码长度为6",groups = {AccountAddValidator.class,AccountUpdValidator.class})
    private String zipcode;
    @NotBlank(message = "qq号码不能为空或全为空格",groups = {AccountAddValidator.class,AccountUpdValidator.class})
    @Length(min = 5,max = 13,message = "qq号的长度为5-13位",groups = {AccountAddValidator.class,AccountUpdValidator.class})
    private String qq;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date lastLoginTime;
    private String lastLoginIp;



    @Override
    public String toString() {
        return "Account{" +
                "accountId=" + accountId +
                ", recommenderId=" + recommenderId +
                ", loginName='" + loginName + '\'' +
                ", loginPasswd='" + loginPasswd + '\'' +
                ", repeat='" + repeat + '\'' +
                ", accountStatus=" + accountStatus +
                ", createDate=" + createDate +
                ", pauseDate=" + pauseDate +
                ", closeDate=" + closeDate +
                ", realName='" + realName + '\'' +
                ", idcardNo='" + idcardNo + '\'' +
                ", birthdate=" + birthdate +
                ", gender='" + gender + '\'' +
                ", occupation='" + occupation + '\'' +
                ", telephone='" + telephone + '\'' +
                ", email='" + email + '\'' +
                ", mailaddress='" + mailaddress + '\'' +
                ", zipcode='" + zipcode + '\'' +
                ", qq='" + qq + '\'' +
                ", lastLoginTime=" + lastLoginTime +
                ", lastLoginIp='" + lastLoginIp + '\'' +
                '}';
    }



    public Integer getAccountId() {
        return accountId;
    }

    public void setAccountId(Integer accountId) {
        this.accountId = accountId;
    }

    public Integer getRecommenderId() {
        return recommenderId;
    }

    public void setRecommenderId(Integer recommenderId) {
        this.recommenderId = recommenderId;
    }

    public String getLoginName() {
        return loginName;
    }

    public void setLoginName(String loginName) {
        this.loginName = loginName;
    }

    public String getLoginPasswd() {
        return loginPasswd;
    }

    public void setLoginPasswd(String loginPasswd) {
        this.loginPasswd = loginPasswd;
    }

    public String getRepeat() {
        return repeat;
    }

    public void setRepeat(String repeat) {
        this.repeat = repeat;
    }

    public Integer getAccountStatus() {
        return accountStatus;
    }

    public void setAccountStatus(Integer accountStatus) {
        this.accountStatus = accountStatus;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public Date getPauseDate() {
        return pauseDate;
    }

    public void setPauseDate(Date pauseDate) {
        this.pauseDate = pauseDate;
    }

    public Date getCloseDate() {
        return closeDate;
    }

    public void setCloseDate(Date closeDate) {
        this.closeDate = closeDate;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public String getIdcardNo() {
        return idcardNo;
    }

    public void setIdcardNo(String idcardNo) {
        this.idcardNo = idcardNo;
    }

    public Date getBirthdate() {
        return birthdate;
    }

    public void setBirthdate(Date birthdate) {
        this.birthdate = birthdate;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String getOccupation() {
        return occupation;
    }

    public void setOccupation(String occupation) {
        this.occupation = occupation;
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getMailaddress() {
        return mailaddress;
    }

    public void setMailaddress(String mailaddress) {
        this.mailaddress = mailaddress;
    }

    public String getZipcode() {
        return zipcode;
    }

    public void setZipcode(String zipcode) {
        this.zipcode = zipcode;
    }

    public String getQq() {
        return qq;
    }

    public void setQq(String qq) {
        this.qq = qq;
    }

    public Date getLastLoginTime() {
        return lastLoginTime;
    }

    public void setLastLoginTime(Date lastLoginTime) {
        this.lastLoginTime = lastLoginTime;
    }

    public String getLastLoginIp() {
        return lastLoginIp;
    }

    public void setLastLoginIp(String lastLoginIp) {
        this.lastLoginIp = lastLoginIp;
    }

}






